<template>
  <div>
    <div class="body">
      <div class="top">
        <div class="tou"></div>
        <div class="box2" v-if="this.$store.state.username !== ''">
          {{ this.$store.state.username }}
        </div>
        <div class="box2" @click="login()" v-else>立即登录</div>
        <i class="iconfont icon-shezhi" @click="bool()"></i>
        <i class="iconfont icon-dianying"></i>
      </div>

      <Zichan :nums="num1" />
      <Zichan :nums="num1" />
      <Zichan :nums="num2" />
      <div class="tuichu" v-show="boolean" @click="tuichu()">退出登录</div>
    </div>

    <Foo class="left" />
  </div>
</template>

<script>
import { getlink } from "@/api/getlink.js";
import Zichan from "./Wode/zichan.vue";
export default {
  data() {
    return {
      boolean: false,
      num1: 4,
      num2: 11,
    };
  },
  components: { Zichan },
  methods: {
    tuichu() {
      this.$store.commit("upuser", { username: "" });
      this.$store.commit("upuserid", { userid: -1 });
    },
    bool() {
      if (this.$store.state.username !== "") {
        this.boolean = !this.boolean;
      }
    },
    login() {
      this.$router.push("/login");
    },
    update() {
      getlink("/data/update", "get", {
        shopid: 3,
        goodsid: 3,
        goodsnums: 2,
      }).then((ok) => {
        console.log(ok.data);
      });
    },
  },
};
</script>

<style scoped>
.top {
  width: 100%;
  height: 0.6rem;
  padding: 0 0.1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.body {
  font-size: 0.16rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
}
.box2 {
  font-size: 0.2rem;
  font-weight: 700;
  margin-right: 1.6rem;
}
.tou {
  width: 0.36rem;
  height: 0.36rem;
  background-color: aqua;
  border-radius: 50%;
}
i {
  font-size: 0.24rem;
}
</style>